package com.springboot.cloud.demos.producer.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.springboot.cloud.demos.entity.po.MomentComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
@Mapper
public interface MomentCommentMapper extends BaseMapper<MomentComment> {

    @Select(" SELECT a.id ,\n" +
            "        a.content,\n" +
            "        a.moment_id as momentId,\n" +
            "        a.created_time as createdTime,\n" +
            "        a.parent_nickname as parentName,\n" +
            "        a.parent_id as parentId,\n" +
            "        a.user_id as userId,\n" +
            "        c.avatar,\n" +
            "        c.nickname from t_moment_comment a left join t_user c on c.id=a.user_id ${ew.customSqlSegment}")
    @Override
    IPage<Map<String, Object>> selectMapsPage(IPage page, @Param("ew") Wrapper queryWrapper);


}
